package com.vmont.encodeapp;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.vmont.encodeapp.activity.BaseActivity;

import org.w3c.dom.Text;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import me.jessyan.autosize.internal.CustomAdapt;

public class LoginActivity extends BaseActivity {

    @BindView(R.id.tv_version)
    TextView tvVersion;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        ButterKnife.bind(this);
        getVersion();
    }


    @OnClick(R.id.bt_login)
    public void onClick() {
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
    }

    /**
     * 获取版本号
     */
    private void getVersion() {
        try {
            // 获取包管理器对象
            PackageManager packageManager = getPackageManager();
            // 获取当前应用的包名
            String packageName = getPackageName();
            // 根据包名获取应用信息
            PackageInfo packageInfo = packageManager.getPackageInfo(packageName, 0);
            // 获取版本号
            String versionName = packageInfo.versionName;
            // 输出版本号
            tvVersion.setText("版本号：" + versionName);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
